package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Stock {
    private long kcId;
    private String cpName;
    private String kcName;
    private Long kcCaijia;
    private List<StockDetails> stockDetailsList;
    @OneToMany(mappedBy = "stock")
    public List<StockDetails> getStockDetailsList() {
        return stockDetailsList;
    }

    public void setStockDetailsList(List<StockDetails> stockDetailsList) {
        this.stockDetailsList = stockDetailsList;
    }

    @Id
    @Column(name = "KC_ID", nullable = false, precision = 0)
    public long getKcId() {
        return kcId;
    }

    public void setKcId(long kcId) {
        this.kcId = kcId;
    }

    @Basic
    @Column(name = "CP_NAME", nullable = true, length = 255)
    public String getCpName() {
        return cpName;
    }

    public void setCpName(String cpName) {
        this.cpName = cpName;
    }

    @Basic
    @Column(name = "KC_NAME", nullable = true, length = 255)
    public String getKcName() {
        return kcName;
    }

    public void setKcName(String kcName) {
        this.kcName = kcName;
    }

    @Basic
    @Column(name = "KC_CAIJIA", nullable = true, precision = 0)
    public Long getKcCaijia() {
        return kcCaijia;
    }

    public void setKcCaijia(Long kcCaijia) {
        this.kcCaijia = kcCaijia;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Stock stock = (Stock) o;
        return kcId == stock.kcId &&
                Objects.equals(cpName, stock.cpName) &&
                Objects.equals(kcName, stock.kcName) &&
                Objects.equals(kcCaijia, stock.kcCaijia);
    }

    @Override
    public int hashCode() {
        return Objects.hash(kcId, cpName, kcName, kcCaijia);
    }
}
